﻿<!doctype html>
 <html >
 <head>
   <meta charset="UTF-8">
   <link rel="stylesheet" href="../../../css/common.css">
   <link rel="stylesheet" href="../../../css/main.css">
   <script type="text/javascript" src="../../../js/jquery.min.js"></script>
   <script type="text/javascript" src="../../../js/colResizable-1.3.min.js"></script>
   <script type="text/javascript" src="../../../js/common.js"></script>
     <script type="text/javascript" src="/layer/layer.js"></script>
   <script>
       $(function () {

           //异步校验角色名
           $("[name='roleName']").blur(function () {
               var roleName=$("[name='roleName']").val();
               if (roleName==""){
                   //小tips
                   layer.tips('角色名不能为空', '#roleName', {
                       tips: [1, '#FD482C'],
                       time: 2000
                   });
                   $("[type='submit']").attr("disabled", "disabled");
               }else {
                   $.ajax({
                       url:"/resource/system/role/ajaxRole",
                       data:{"roleName":roleName},
                       type:"post",
                       dataType:"json",
                       success: function (re) {
                           if (re > 0) {
                               //小tips
                               layer.tips('角色名已存在', '#roleName', {
                                   tips: [1, '#FD482C'],
                                   time: 4000
                               });
                               $("[type='submit']").attr("disabled", "disabled");

                           } else {

                               //小tips
                               layer.tips('角色名可用', '#roleName', {
                                   tips: [1, 'green'],
                                   time: 1000
                               });
                               $("[type='submit']").removeAttr("disabled")
                           }
                       }
                   })
               }

           })
       });
   </script>
</head>

<body>
  <div id="forms" class="mt10">
        <div class="box">
          <div class="box_border">
            <div class="box_top"><b class="pl15">添加角色</b></div>
            <div class="box_center">
              <form action="/resource/system/role/addRole" class="jqtransform">
               <table class="form_table pt15 pb15" width="100%" border="0" cellpadding="0" cellspacing="0">
                 <tr>
                  <td class="td_right">角色名称：</td>
                  <td class=""> 
                    <input type="text" id="roleName" name="roleName" required class="input-text lh30" size="40"/><span></span>
                  </td>
				  </tr>
				  <tr>
                  <td class="td_right">备注：</td><td> <textarea name="roleDesc" required id="" cols="30" rows="10" class="textarea"></textarea></td>
                </tr>
                 <tr>
                  <td class="td_right">状态：</td>
                  <td class="">
                    <input type="radio" name="roleStatus" value="1"  checked/> 启用
                    <input type="radio" name="roleStatus" value="0"/> 禁用
                  </td>
                 </tr>
                 
                <tr>
                  <td class="td_right">权限：</td>
                    <#--1、2级菜单-->
                  <td class="">
                      <#list menu as m>
                          <#if (m.superMenuId==0)>
                           <input type="checkbox" name="menuId" value="${m.menuId}">${m.menuName}<br/>
                              <#list m.menus as second>
                                  &nbsp;&nbsp;<input type="checkbox" name="menuId" value="${second.menuId}">${second.menuName}<br/>
                              </#list>
                          </#if>
                      </#list>
					&nbsp;&nbsp;&nbsp;<#--<input type="checkbox" name="check" >角色管理<br/>
					&nbsp;&nbsp;&nbsp;<input type="checkbox" name="check" >菜单管理<br/>
					&nbsp;&nbsp;&nbsp;<input type="checkbox" name="check" >操作日志<br/>-->
				  </td>
                 </tr>

                   <td class="td_right">&nbsp;</td>
                   <td class="">
                     <input type="submit" name="button" class="btn btn82 btn_save2" value="保存"> 
                    <input type="button" name="button" class="btn btn82 btn_res" onclick="location.href='javascript:history.go(-1)'" value="返回"> 
                   </td>
                 </tr>
               </table>
               </form>
            </div>
          </div>
        </div>
     </div>
   </div> 
</body>

</html>